<?php
$a=$_POST["q36"];
$b=$_POST["q37"];
if($a>=1 && $b>=1)
{echo "湿热质的调查中不能同时回答第6题和第7题，请重新选择" . "<br />";
    exit();
}
echo "1.阳虚质" . "<br />";
$n=0;
for($k = 1; $k <= 7; $k++)
{
 echo "the result of question $k is: " . $_POST["q$n"] . "<br />";
 $sum1 = $sum1 + $_POST["q$n"];
 $n++;
}
$zhuan1=(($sum1 - 7)/28) * 100 ;
echo "原始分: " . $sum1 . "<br />";
echo "转化分: " . $zhuan1 . "<br />";
echo "<br />";
echo "<br />";
echo "2.阴虚质" . "<br />";
for($k = 1; $k <= 8; $k++)
{
 echo "the result of question $k is: " . $_POST["q$n"] . "<br />";
 $sum2 = $sum2 + $_POST["q$n"];
 $n++;
}
$zhuan2=(($sum2 - 8)/32) * 100 ;
echo "原始分: " . $sum2 . "<br />";
echo "转化分: " . $zhuan2 . "<br />";
echo "<br />";
echo "<br />";
echo "3.气虚质" . "<br />";
for($k = 1; $k <= 8; $k++)
{
 echo "the result of question $k is: " . $_POST["q$n"] . "<br />";
 $sum3 = $sum3 + $_POST["q$n"];
 $n++;
}
$zhuan3=(($sum3 - 8)/32) * 100 ;
echo "原始分: " . $sum3 . "<br />";
echo "转化分: " . $zhuan3 . "<br />";
echo "<br />";
echo "<br />";
echo "4.痰湿质" . "<br />";
for($k = 1; $k <= 8; $k++)
{
 echo "the result of question $k is: " . $_POST["q$n"] . "<br />";
 $sum4 = $sum4 + $_POST["q$n"];
 $n++;
}
$zhuan4=(($sum4 - 8)/32) * 100 ;
echo "原始分: " . $sum4 . "<br />";
echo "转化分: " . $zhuan4 . "<br />";
echo "<br />";
echo "<br />";
echo "5.湿热质" . "<br />";
for($k = 1; $k <= 7; $k++)
{
 echo "the result of question $k is: " . $_POST["q$n"] . "<br />";
 $sum5 = $sum5 + $_POST["q$n"];
 $n++;
}
$zhuan5=(($sum5 - 6)/24) * 100 ;
echo "原始分: " . $sum5 . "<br />";
echo "转化分: " . $zhuan5 . "<br />";
echo "<br />";
echo "<br />";
echo "6.血瘀质" . "<br />";
for($k = 1; $k <= 7; $k++)
{
 echo "the result of question $k is: " . $_POST["q$n"] . "<br />";
 $sum6 = $sum6 + $_POST["q$n"];
 $n++;
}
$zhuan6=(($sum6 - 7)/28) * 100 ;
echo "原始分: " . $sum6 . "<br />";
echo "转化分: " . $zhuan6 . "<br />";
echo "<br />";
echo "<br />";
echo "7.特禀质" . "<br />";
for($k = 1; $k <= 7; $k++)
{
 echo "the result of question $k is: " . $_POST["q$n"] . "<br />";
 $sum7 = $sum7 + $_POST["q$n"];
 $n++;
}
$zhuan7=(($sum7 - 7)/28) * 100 ;
echo "原始分: " . $sum7 . "<br />";
echo "转化分: " . $zhuan7 . "<br />";
echo "<br />";
echo "<br />";
echo "8.气郁质" . "<br />";
for($k = 1; $k <= 7; $k++)
{
 echo "the result of question $k is: " . $_POST["q$n"] . "<br />";
 $sum8 = $sum8 + $_POST["q$n"];
 $n++;
}
$zhuan8=(($sum8 - 7)/28) * 100 ;
echo "原始分: " . $sum8 . "<br />";
echo "转化分: " . $zhuan8 . "<br />";
echo "<br />";
echo "<br />";
echo "9.平和质" . "<br />";
for($k = 1; $k <= 8; $k++)
{
 echo "the result of question $k is: " . $_POST["q$n"] . "<br />";
 $sum9 = $sum9 + $_POST["q$n"];
 $n++;
}
$zhuan9=(($sum9 - 8)/32) * 100 ;
echo "原始分: " . $sum9 . "<br />";
echo "转化分: " . $zhuan9 . "<br />";
echo "<br />";
echo "<br />";

$pan = array(1,$zhuan1,$zhuan2,$zhuan3,$zhuan4,$zhuan5,$zhuan6,$zhuan7,$zhuan8,$zhuan9);
echo "患者： " .$_POST["question"] . "<br />";
echo "您的体质";
for($k = 1; $k <= 8; $k++)
{
    if($pan[$k] >= 40 )
    {$zhuan9=1;}
}


if($zhuan9 >= 60)
{
    echo "是平和质";
    $w9=1;
for($k = 1; $k <= 8; $k++)
{
    if($pan[$k] < 40 && $pan[$k] >= 30 )
    {
        switch ($k)
{
case 1:
    echo ",有阳虚质倾向";
    $w1=1;
    $w9=0;
    break;
case 2:
    echo ",有阴虚质倾向";
    $w2=1;
    $w9=0;
    break;
case 3:
    echo ",有气虚质倾向";
    $w3=1;
    $w9=0;
    break;
case 4:
     echo ",有痰湿质倾向";
     $w4=1;
     $w9=0;
    break;
 case 5:
     echo ",有湿热质倾向";
     $w5=1;
     $w9=0;
    break;
 case 6:
    echo ",有血瘀质倾向";
    $w6=1;
    $w9=0;
    break;
case 7:
    echo ",有特禀质倾向";
    $w7=1;
    $w9=0;
    break;
case 8:
    echo ",有气郁质倾向";
    $w8=1;
    $w9=0;
    break;
}
}

}

}




if($zhuan9 < 60)
{
    for($k = 1; $k <= 8; $k++)
    {
        if($pan[$k] >= 40 )
        {
            switch ($k)
    {
    case 1:
        echo "是阳虚质 ";
        $w1=1;
        break;
    case 2:
        echo "是阴虚质 ";
        $w2=1;
        break;
    case 3:
        echo "是气虚质 ";
        $w3=1;
        break;
    case 4:
         echo "是痰湿质 ";
         $w4=1;
        break;
    case 5:
         echo "是湿热质 ";
         $w5=1;
         break;
    case 6:
        echo "是血瘀质 ";
        $w6=1;
        break;
     case 7:
         echo "是特禀质 ";
         $w7=1;
        break;
    case 8:
         echo "是气郁质 ";
         $w8=1;
          break;
    }
    } 
}
for($k = 1; $k <= 8; $k++)
    {
        if($pan[$k] < 40 && $pan[$k] >= 30 )
        {
            switch ($k)
    {
    case 1:
        echo " 有阳虚质倾向 ";
        $w1=1;
        break;
    case 2:
        echo " 有阴虚质倾向 ";
        $w2=1;
        break;
    case 3:
        echo " 有气虚质倾向 ";
        $w3=1;
        break;
    case 4:
            echo " 有痰湿质倾向 ";
            $w4=1;
            break;
    case 5:
            echo " 有湿热质倾向 ";
            $w5=1;
            break;
     case 6:
            echo " 有血瘀质倾向 ";
            $w6=1;
            break;
    case 7:
                echo " 有特禀质倾向 ";
                $w7=1;
                break;
    case 8:
                echo " 有气郁质倾向 ";
                $w8=1;
                break;
        }
    } 
    if($pan[$k] < 30)
{$ping = $ping+ 1 ;}
}


if($ping == 8)
{echo " 无体质判定结果，建议重新测试 ";
    exit();}


}


echo "<br />" . "<br />";
echo "根据体质为您推荐以下膳食：" . "<br />";
if($w1 == 1)
{
    echo "--阳虚体质--" . "<br />" . "可能导致的问题：" . "肌肉不健壮，常感手脚发凉，衣服比别人穿得多，夏天不喜欢吹空调，喜安静，性格多沉静、内向。". "<br />";
    echo "药膳调补：" . "羊肉羹". "<br />". "【原料】瘦羊肉80克". "<br />"."【做法】取煮熟的瘦羊肉，用刀背砍成泥状，置碗中，注入60毫升羊肉汤，放少许鲜姜汁、蒜泥、料酒、味精、盐、淀粉，拌匀后置笼上蒸45分钟，热食。". "<br />" ."【功效】温补阳气。". "<br />";
}

if($w2 == 1)
{
    echo "--阴虚体质--" . "<br />" . "可能导致的问题：" . "体形多瘦长，不耐暑热，常感眼睛干涩、口干咽燥，总想喝水，皮肤干燥，常大便干结，易失眠。". "<br />";
    echo "药膳调补：" . "沙参玉竹炖猪心". "<br />". "【原料】猪心1个，沙参,玉竹各20克，,红枣8粒，盐适量。". "<br />"."【做法】1、猪心挤出血水,洗净,氽烫备用.药材冲洗干净,红枣泡软。" . "<br />"."2、炖盅内加水,将全部材料放入,煮开后改小火炖煮约1小时,加盐调味即可。". "<br />" ."【功效】滋阴宁心。". "<br />";
}

if($w3 == 1)
{
    echo "--气虚体质--" . "<br />" . "可能导致的问题：" . "肌肉松软，声音低，易出汗，易累，易感冒。". "<br />";
    echo "药膳调补：" . "<br />". "1.黄芪童子鸡". "<br />". "【原料】童子鸡一只，生黄芪15克，葱、姜、盐、黄酒适量。". "<br />"."2.山药粥" . "<br />"."山药30克，粳米180克。". "<br />" ;
}

if($w4 == 1)
{
    echo "--痰湿体质--" . "<br />" . "可能导致的问题：" . " 体形肥胖，腹部肥满而松软，易出汗，且多黏腻，经常感觉脸上有一层油。". "<br />";
    echo "药膳调补：" . "薏米冬瓜汤". "<br />". "【原料】薏米30克，冬瓜150克。". "<br />" ."【功效】健脾，益气利湿。". "<br />";
}

if($w5 == 1)
{
    echo "--湿热体质--" . "<br />" . "可能导致的问题：" . "面部、鼻尖总是油光发亮，脸上易生粉刺，皮肤易瘙痒。常感到口苦、口臭，脾气较急躁。". "<br />";
    echo "药膳调补：" . "薏米绿豆粥". "<br />". "【原料】薏米30克，绿豆30克，大米50克。". "<br />" ."【功效】清利湿热。". "<br />";
}

if($w6 == 1)
{
    echo "--血瘀体质--" . "<br />" . "可能导致的问题：" . "皮肤较粗糙，女性表现为痛经，血块较多，舌质暗。". "<br />";
    echo "药膳调补：" . "丹参炖田鸡". "<br />". "【原料】丹参15g，田鸡250g，红枣4枚。". "<br />"."【做法】将田鸡去皮爪和内脏，红枣去核，与丹参一起放入沙锅，加水旺火烧沸，改文火炖煮2小时，加调料即成。". "<br />" ."【功效】活血化瘀，清热解毒。". "<br />";
}

if($w7 == 1)
{
    echo "--特禀体质--" . "<br />" . "可能导致的问题：" . "易对药物、食物、气味、花粉、季节过敏。". "<br />";
}


if($w8 == 1)
{
    echo "--气郁体质--" . "<br />" . "可能导致的问题：" . "体形偏瘦，常感到闷闷不乐、情绪低沉，常有胸闷，经常无缘无故地叹气，易失眠。". "<br />";
    echo "药膳调补：" . "菊花玫瑰茶". "<br />". "【原料】杭白菊4朵，玫瑰花2朵。". "<br />" ."【做法】90℃水沏。". "<br />";
}

if($w9 == 1)
{
    echo "--平和体质--" . "<br />" . "体质特征：" . "肤色润泽，唇红润，精力充沛，饮食睡眠良好，二便正常，舌淡红，脉和缓。". "<br />";
    echo "药膳调补：" . "茯苓大枣山药粥". "<br />". "【原料】茯苓20克，大枣10克，山药20克，粳米50克，枸杞少许，红糖适量。". "<br />"."【做法】大枣去核，与茯苓、山药、粳米、枸杞同煮成粥，加适量红糖调味即可。". "<br />" ."【功效】健运脾胃，渗湿止泻。". "<br />";
}


?>
